import {View} from "@tarojs/components";
import {ReactElement} from "react";

type ModalViewProps = {
  show: boolean,
  children: ReactElement | null,
  style?: {}
}

export default (props: ModalViewProps) => {
  const { show, children=null, style={} } = props
  if (!show) return null
  return (
    <View style={{
      position: 'absolute',
      top: 0,
      left: 0,
      width: '100%',
      height: '100vh',
      backgroundColor: 'rgba(51,51,51,0.7)',
      ...style
    }}>
      {children}
    </View>
  )
}

